#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	int a[] = { 1,2,3,4 };
	do
	{
		for (int i = 0; i < 4; i++)
		{
			cout << a[i];
		}
		cout << endl;
	} while (next_permutation(a, a + 4));
	return 0;
}